package com.tang.base;

import android.util.Log;

import com.google.gson.Gson;
import com.tang.util.AESUtil;
import com.tang.util.GsonUtil;
import com.tang.util.Sha1Util;

import java.util.HashMap;
import java.util.Map;

import okhttp3.MediaType;
import okhttp3.RequestBody;

public class NetMapEncryptUtils {
    private final Object req;

    public NetMapEncryptUtils(Object req) {
        this.req = req;
    }

    public Map<String, Object> getMaps() {
        String encryptedData = AESUtil.aesEncrypt(GsonUtil.toJsonStr(req));
        long timeStamp = System.currentTimeMillis();
        String sign = Sha1Util.encryptToSHA(encryptedData + System.currentTimeMillis());
        Map<String, Object> map = new HashMap<>();//body  map
        map.put("encryptedData", encryptedData);
        map.put("timestamp", timeStamp);
        map.put("sign", sign);
        Log.e("http", "getMaps: " + GsonUtil.toJsonStr(req));
        return map;
    }
}
